<div class="layui-fluid" id="febs-project-exam" lay-title="审核项目">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">是否通过</label>
            <div class="layui-input-block">
                <input type="radio" name="state" value="2" title="未通过">
                <input type="radio" name="state" value="3" title="通过">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" placeholder="未通过，必须说明原因" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item febs-hide">
            <div class="layui-input-block">
                <button hidden class="layui-btn hidden" lay-submit lay-filter="formDemo" id="submit">立即提交</button>
            </div>
        </div>
    </form>
</div>
<script>
    //Demo
    layui.use(['form', 'layedit','febs'],function(){
        var form = layui.form,
        febs = layui.febs,
        layedit = layui.layedit
        projectId = [[${projectId}]];


        form.render();
        //监听提交
        form.on('submit(formDemo)', function(data){
            //layer.msg(JSON.stringify(data.field));
            var data = data.field;
            if (data.state == null){
                febs.modal.error('错误',"请选择是否通过")
                return false;
            }
            var remark = data.remark;
            if (data.state == 2 && remark == ""){
                febs.modal.error('错误',"未通过必须说明原因")
                return false;
            }
            data.projectId = projectId;
            febs.post(ctx + 'examProject', data, function (data) {
                console.log(data)
                if (data.code == '200'){
                    layer.closeAll();
                }
            });
            return false;
        });
    });
</script>